package com.fuqi.android.zhongcai.business.shuig.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.Checkable;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.fuqi.android.zhongcai.R;

/**
 * Created by Bruce on 2016/10/25.
 */
public class AnswerView extends LinearLayout implements Checkable {
    private TextView mTitle;
    private CheckBox mCheckBox;

    public AnswerView(Context context) {
        this(context, null);
    }

    public AnswerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.widget_list_answer_item, this, true);
        mTitle = (TextView) v.findViewById(R.id.tv_title);
        mCheckBox = (CheckBox) v.findViewById(R.id.cb_sel);
    }

    public void setTitle(String title) {
        mTitle.setText(title);
    }

    @Override
    public boolean isChecked() {
        return mCheckBox.isChecked();
    }

    @Override
    public void setChecked(boolean checked) {
        mCheckBox.setChecked(checked);
    }

    @Override
    public void toggle() {
        mCheckBox.toggle();
    }


}
